package com.xps.and.yuntong.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.xps.and.yuntong.Entity.Pingjia;
import com.xps.and.yuntong.R;

import java.util.List;

/**
 * Created by administrator on 2017-12-12.
 */

public class PingjiaAdapter extends BaseAdapter {
    private Context context;
    private LayoutInflater layoutInflater;
    //        private List<Food> data;
    private List<Pingjia> data;

    public PingjiaAdapter(Context context, List data_item) {
        this.context = context;
        this.data = data_item;

        layoutInflater = layoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return data.size();
//            return 4;
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
//            return 1;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        View view = null;
        final ViewHolder viewHolder;

        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.pingjia_item, null);
            viewHolder = new ViewHolder();


            viewHolder.tv_neirong = (TextView) convertView.findViewById(R.id.tv_neirong);
            viewHolder.tv_fenshu = (TextView) convertView.findViewById(R.id.tv_fenshu);

            viewHolder.iv_big_xing = (ImageView) convertView.findViewById(R.id.iv_big_xing);
            viewHolder.iv_big_xing1 = (ImageView) convertView.findViewById(R.id.iv_big_xing1);
            viewHolder.iv_big_xing2 = (ImageView) convertView.findViewById(R.id.iv_big_xing2);
            viewHolder.iv_big_xing3 = (ImageView) convertView.findViewById(R.id.iv_big_xing3);
            viewHolder.iv_account = (ImageView) convertView.findViewById(R.id.iv_account);


            convertView.setTag(viewHolder);

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }


        viewHolder.tv_neirong.setText(data.get(position).getPingjia_neirong());
        viewHolder.tv_fenshu.setText(data.get(position).getPingjia_fenshu());


        return convertView;
    }

    public class ViewHolder {

        ImageView iv_big_xing;
        ImageView iv_big_xing1;
        ImageView iv_big_xing2;
        ImageView iv_big_xing3;
        ImageView iv_account;
        TextView tv_neirong;
        TextView tv_fenshu;



    }


}